<template>
    <div class="top">
        <div class="content">
            <div class="left" @click="$router.push('/')">
                <img src="../../assets/images/logo.png" alt="">
                <p>尚<!--  -->医通 预约挂号统一平台</p>
            </div>
            <div class="right"><!--  -->
                <p>帮助中心</p>
                <p @click="userStore.visible = true" v-if="!userStore.userInfo.token">登录/注册</p>
                <el-dropdown v-else class="info">
                    <span class="el-dropdown-link">
                        {{ userStore.userInfo?.name }}
                        <el-icon class="el-icon--right">
                            <arrow-down />
                        </el-icon>
                    </span>
                    <template #dropdown>
                        <el-dropdown-menu>
                            <el-dropdown-item @click="$router.push('/user/certification')">实名认证</el-dropdown-item>
                            <el-dropdown-item @click="$router.push('/user/order')">挂号订单</el-dropdown-item>
                            <el-dropdown-item @click="$router.push('/user/patient')">就诊管理</el-dropdown-item>
                            <el-dropdown-item @click="userStore.logout">退出登录</el-dropdown-item>
                        </el-dropdown-menu>
                    </template>
                </el-dropdown>
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import { ArrowDown } from '@element-plus/icons-vue'
import useUserStore from '@/store/modules/user';
import { useRouter } from 'vue-router';
let userStore = useUserStore()
let $router = useRouter()
</script>

<style scoped lang="scss">
.top {
    width: 100%;
    height: 70px;
    display: flex;
    justify-content: center;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 99;
    background: #fff;
    box-shadow: 0 0 10px 0 rgba(0, 0, 0, .1);

    .content {
        width: 80%;
        height: 100%;
        display: flex;
        justify-content: space-between;

        .left {
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;

            img {
                width: 60px;
                margin-right: 10px;
            }

            p {
                font-size: 22px;
                color: #55a6fe;
            }
        }

        .right {
            display: flex;
            align-items: center;
            justify-content: center;

            .info {
                cursor: pointer;
            }

            p {
                margin: 0 0 0 10px;
                font-size: 16px;
                color: #aaa;
                cursor: pointer;
                margin-right: 10px;
            }
        }
    }
}
</style>